package com.zpyr.startup;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import com.zpyr.common.LogManager;
import com.zpyr.common.database.DBManager;

public class StartFilter implements Filter {
	
	private static boolean opt1_dbload;
	
	@Override
	public void destroy() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1,
			FilterChain arg2) throws IOException, ServletException {
	}

	@Override
	/**
	 * 이 메소드안에 tomcat 웹서버 구동시 실행할 것들이 위치한다.
	 */
	public void init(FilterConfig arg0) throws ServletException {
		LogManager logger = new LogManager();
/*
		opt1_dbload = DBManager.dbLoading();
		
		if( opt1_dbload ) {
			logger.info("DB 연결 되었습니다.");
		}
		else {
			logger.error("DB 연결에 실패하였습니다.");
		}
*/		
		logger.info("ocpek2 웹서버 시작되었습니다.");
	}
	
}
